#pragma once
#include "DataConversion.h"
#include <vcclr.h>

namespace dotNetInteropPlugin {
	namespace PluginDev {
		using namespace System;
		using namespace System::Runtime::InteropServices;


	private ref class MAIMPEqualizer: public MarshalByRefObject, public IMAIMPEqualizer, public System::IDisposable
	{
	public:
		MAIMPEqualizer(IAIMP2Controller* Ctrl)
		{
			inAIMPCtrl = Ctrl;
			inAIMPCtrl->AddRef();
		}

		property virtual Boolean  Enabled
		{
			Boolean get()
			{
				return inAIMPCtrl->AIMP_Status_Get(AIMP_STS_EQ_STS) != 0;
			}
			void set(Boolean value)
			{
				inAIMPCtrl->AIMP_Status_Set(AIMP_STS_EQ_STS, value);
			}
		}

		property virtual Int32  Slider31Hz
		{
			Int32 get()
			{
				return inAIMPCtrl->AIMP_Status_Get(AIMP_STS_EQ_SLDR01);
			}
			void set(Int32 value)
			{
				inAIMPCtrl->AIMP_Status_Set(AIMP_STS_EQ_SLDR01, value);
			}
		}
		property virtual Int32  Slider63Hz
		{
			Int32 get()
			{
				return inAIMPCtrl->AIMP_Status_Get(AIMP_STS_EQ_SLDR02) - 50;
			}
			void set(Int32 value)
			{
				inAIMPCtrl->AIMP_Status_Set(AIMP_STS_EQ_SLDR02, value + 50);
			}
		}
		property virtual Int32  Slider125Hz
		{
			Int32 get()
			{
				return inAIMPCtrl->AIMP_Status_Get(AIMP_STS_EQ_SLDR03) - 50;
			}
			void set(Int32 value)
			{
				inAIMPCtrl->AIMP_Status_Set(AIMP_STS_EQ_SLDR03, value + 50);
			}
		}
		property virtual Int32  Slider170Hz
		{
			Int32 get()
			{
				return inAIMPCtrl->AIMP_Status_Get(AIMP_STS_EQ_SLDR04) - 50;
			}
			void set(Int32 value)
			{
				inAIMPCtrl->AIMP_Status_Set(AIMP_STS_EQ_SLDR04, value + 50);
			}
		}
		property virtual Int32  Slider250Hz
		{
			Int32 get()
			{
				return inAIMPCtrl->AIMP_Status_Get(AIMP_STS_EQ_SLDR05) - 50;
			}
			void set(Int32 value)
			{
				inAIMPCtrl->AIMP_Status_Set(AIMP_STS_EQ_SLDR05, value + 50);
			}
		}
		property virtual Int32  Slider310Hz
		{
			Int32 get()
			{
				return inAIMPCtrl->AIMP_Status_Get(AIMP_STS_EQ_SLDR06) - 50;
			}
			void set(Int32 value)
			{
				inAIMPCtrl->AIMP_Status_Set(AIMP_STS_EQ_SLDR06, value + 50);
			}
		}
		property virtual Int32  Slider600Hz
		{
			Int32 get()
			{
				return inAIMPCtrl->AIMP_Status_Get(AIMP_STS_EQ_SLDR07) - 50;
			}
			void set(Int32 value)
			{
				inAIMPCtrl->AIMP_Status_Set(AIMP_STS_EQ_SLDR07, value + 50);
			}
		}
		property virtual Int32  Slider1000Hz
		{
			Int32 get()
			{
				return inAIMPCtrl->AIMP_Status_Get(AIMP_STS_EQ_SLDR08) - 50;
			}
			void set(Int32 value)
			{
				inAIMPCtrl->AIMP_Status_Set(AIMP_STS_EQ_SLDR08, value + 50);
			}
		}
		property virtual Int32  Slider1500Hz
		{
			Int32 get()
			{
				return inAIMPCtrl->AIMP_Status_Get(AIMP_STS_EQ_SLDR09) - 50;
			}
			void set(Int32 value)
			{
				inAIMPCtrl->AIMP_Status_Set(AIMP_STS_EQ_SLDR09, value + 50);
			}
		}
		property virtual Int32  Slider2kHz
		{
			Int32 get()
			{
				return inAIMPCtrl->AIMP_Status_Get(AIMP_STS_EQ_SLDR10) - 50;
			}
			void set(Int32 value)
			{
				inAIMPCtrl->AIMP_Status_Set(AIMP_STS_EQ_SLDR10, value + 50);
			}
		}
		property virtual Int32  Slider3kHz
		{
			Int32 get()
			{
				return inAIMPCtrl->AIMP_Status_Get(AIMP_STS_EQ_SLDR11) - 50;
			}
			void set(Int32 value)
			{
				inAIMPCtrl->AIMP_Status_Set(AIMP_STS_EQ_SLDR11, value + 50);
			}
		}
		property virtual Int32  Slider4kHz
		{
			Int32 get()
			{
				return inAIMPCtrl->AIMP_Status_Get(AIMP_STS_EQ_SLDR12) - 50;
			}
			void set(Int32 value)
			{
				inAIMPCtrl->AIMP_Status_Set(AIMP_STS_EQ_SLDR12, value + 50);
			}
		}
		property virtual Int32  Slider6kHz
		{
			Int32 get()
			{
				return inAIMPCtrl->AIMP_Status_Get(AIMP_STS_EQ_SLDR13) - 50;
			}
			void set(Int32 value)
			{
				inAIMPCtrl->AIMP_Status_Set(AIMP_STS_EQ_SLDR13, value + 50);
			}
		}
		property virtual Int32  Slider8kHz
		{
			Int32 get()
			{
				return inAIMPCtrl->AIMP_Status_Get(AIMP_STS_EQ_SLDR14) - 50;
			}
			void set(Int32 value)
			{
				inAIMPCtrl->AIMP_Status_Set(AIMP_STS_EQ_SLDR14, value + 50);
			}
		}
		property virtual Int32  Slider10kHz
		{
			Int32 get()
			{
				return inAIMPCtrl->AIMP_Status_Get(AIMP_STS_EQ_SLDR15) - 50;
			}
			void set(Int32 value)
			{
				inAIMPCtrl->AIMP_Status_Set(AIMP_STS_EQ_SLDR15, value + 50);
			}
		}
		property virtual Int32  Slider12kHz
		{
			Int32 get()
			{
				return inAIMPCtrl->AIMP_Status_Get(AIMP_STS_EQ_SLDR16) - 50;
			}
			void set(Int32 value)
			{
				inAIMPCtrl->AIMP_Status_Set(AIMP_STS_EQ_SLDR16, value + 50);
			}
		}
		property virtual Int32  Slider14kHz
		{
			Int32 get()
			{
				return inAIMPCtrl->AIMP_Status_Get(AIMP_STS_EQ_SLDR17) - 50;
			}
			void set(Int32 value)
			{
				inAIMPCtrl->AIMP_Status_Set(AIMP_STS_EQ_SLDR17, value + 50);
			}
		}
		property virtual Int32  Slider16kHz 
		{
			Int32 get()
			{
				return inAIMPCtrl->AIMP_Status_Get(AIMP_STS_EQ_SLDR18) - 50;
			}
			void set(Int32 value)
			{
				inAIMPCtrl->AIMP_Status_Set(AIMP_STS_EQ_SLDR18, value + 50);
			}
		}



		property virtual Int32 default[Int32]
		{
			Int32 get(Int32 ID)
			{
				return inAIMPCtrl->AIMP_Status_Get(AIMP_STS_EQ_SLDR01 + ID) - 50;
			}
			void set(Int32 ID, Int32 value)
			{
				if (ID < SlidersCount - 1)
					inAIMPCtrl->AIMP_Status_Set(AIMP_STS_EQ_SLDR01 + ID + 1, value + 50);
			}
		}

		property virtual Int32 SlidersCount
		{
			Int32 get()
			{
				return inSldrVals->Count;
			}
		}

		property virtual System::Collections::ObjectModel::ReadOnlyCollection<UInt32>^ SlidersValues
		{
			System::Collections::ObjectModel::ReadOnlyCollection<UInt32>^ get()
			{
				return inSldrVals;
			}
		}

		~MAIMPEqualizer()
		{
			if (inAIMPCtrl != NULL)
			{
				inAIMPCtrl->Release();
				inAIMPCtrl = NULL;
			}
		}

	private:
		IAIMP2Controller* inAIMPCtrl;
		static System::Collections::ObjectModel::ReadOnlyCollection<UInt32>^ inSldrVals = gcnew System::Collections::ObjectModel::ReadOnlyCollection<UInt32>(safe_cast< System::Collections::Generic::IList<UInt32>^ > (gcnew array<UInt32> { 31, 63, 125, 170, 250, 310, 600, 1000, 1500, 2000, 3000, 4000, 6000, 8000, 10000, 12000, 14000, 16000 }));
	};

}
}